from selenium import webdriver

import time

from selenium.webdriver.common.by import By

# 指明驱动路径 放在d盘根目录时使用
service = webdriver.ChromeService(executable_path='D:\\chromedriver.exe')
# 得到浏览器实例
driver = webdriver.Chrome(service=service)

# 打开页面
driver.get("https://www.baidu.com/")

# 找到元素
input_element = driver.find_element(By.ID, 'chat-textarea')

# 输入内容
input_element.clear()
input_element.send_keys("郑州")
time.sleep(1)

# 模拟点击
button_element = driver.find_element(By.ID, 'chat-submit-button')
button_element.click()

time.sleep(5)
# 关闭浏览器
driver.close()

